{* Вкладка СЧЕТА *}

<div class="tabs">
    <ul>
	<li><a href="#invoice-rtk">Регион-Телеком</a></li>
	<li><a href="#invoice-inline">Инлайн</a></li>
    </ul>

<!-- Под-ВКЛАДКА Счета-ТТК -->
    <div id="invoice-rtk">
	<table class="ui-widget" cellspacing="0" rules="all" style="border: solid 1px #000000;">
	    <thead class="ui-widget-header">
		<tr>
		    <th>Дата</th>
		    <th>Номер</th>
		    <th>Название документа</th>
		    <th>Файл</th>
		    <th>&nbsp;</th>
		</tr>
	    </thead>

	    <tbody class="ui-widget-content">
	    {foreach from=$docs_rtk item=doc}
	    {assign var="mime" value=$doc.filename|regex_replace:'/.+\.(.+)$/':'$1'|lower}
		<tr>
		    <td>{$doc.document_date|date_format:'%d.%m.%Y'}</td>
		    <td>{$doc.document_num}</td>
		    <td>{$doc.document_name}</td>
		    <td>
			<a href="/cgi-bin/dl.cgi?id={$doc.id}">
			    {if $mime=='jpg' || $mime=='gif' || $mime=='png' || $mime=='bmp'}
			<img src="images/icons/mimetypes/image.png" border="0"/>
			    {elseif $mime=='pdf'}
			<img src="images/icons/mimetypes/pdf-document.png" border="0"/>
			    {elseif $mime=='txt'}
			<img src="images/icons/mimetypes/txt.png" border="0"/>
			    {else}
			<img src="images/icons/mimetypes/unknown.png" border="0"/>
			    {/if}
			{$doc.filename}
			</a>
			<i>({math equation='x/1024' x=$doc.size format='%0.2f'} КБ)</i>
		    </td>
		    <td align="center"><a href="document-delete.php?id={$doc.id}"><img src="images/icons/delete_16.png" border="0" title="Удалить"/></a></td>
		</tr>
	    {foreachelse}
		<tr><td align="center" colspan="5"><i>документы не загружены</i></td></tr>
	    {/foreach}
	    </tbody>
	</table>
	<br/>
	<a href="javascript:void(0)" id="act-print-rtk">Получить бланк Акта</a><br/>
	<a href="javascript:void(0)" id="invoice-print-rtk">Получить бланк Счёта</a>
    </div>

<!-- Под-ВКЛАДКА Счета-Инлайн -->
    <div id="invoice-inline">
	<table class="ui-widget" cellspacing="0" rules="all" style="border: solid 1px #000000;">
	    <thead class="ui-widget-header">
		<tr>
		    <th>Дата</th>
		    <th>Номер</th>
		    <th>Название документа</th>
		    <th>Файл</th>
		    <th>&nbsp;</th>
		</tr>
	    </thead>
	    <tbody class="ui-widget-content">
	    {foreach from=$docs_inline item=doc}
	    {assign var="mime" value=$doc.filename|regex_replace:'/.+\.(.+)$/':'$1'|lower}
		<tr>
		    <td>{$doc.document_date|date_format:'%d.%m.%Y'}</td>
		    <td>{$doc.document_num}</td>
		    <td>{$doc.document_name}</td>
		    <td>
			<a href="/cgi-bin/dl.cgi?id={$doc.id}">
			{if $mime=='jpg' || $mime=='gif' || $mime=='png' || $mime=='bmp'}
			    <img src="images/icons/mimetypes/image.png" border="0"/>
			{elseif $mime=='pdf'}
			    <img src="images/icons/mimetypes/pdf-document.png" border="0"/>
			{elseif $mime=='txt'}
			    <img src="images/icons/mimetypes/txt.png" border="0"/>
			{else}
			    <img src="images/icons/mimetypes/unknown.png" border="0"/>
			{/if}
			    {$doc.filename}
			</a>
			<i>({math equation='x/1024' x=$doc.size format='%0.2f'} КБ)</i>
		    </td>
		    <td align="center"><a href="document-delete.php?id={$doc.id}"><img src="images/icons/delete_16.png" border="0" title="Удалить"/></a></td>
		</tr>
	    {foreachelse}
		<tr>
		    <td align="center" colspan="5"><i>документы не загружены</i></td></tr>
	    {/foreach}
	    </tbody>
	</table>
	<br/>
	<a href="javascript:void(0)" id="act-print-inline">Получить бланк Акта</a><br/>
	<a href="javascript:void(0)" id="invoice-print-inline">Получить бланк Счёта</a>
    </div>
</div>

<a href="javascript:void(0)" id="document-add-invoice"><img src="images/icons/plus_16.png" border="0"/>&nbsp;Добавить документ</a>
<br/><br/>

<div class="ui-widget {if $by_period==1}ui-state-default{else}ui-state-disabled{/if} ui-corner-all div-set-period">
    <form method="get" action="#invoice">
	<input type="hidden" name="id" value="{$customer.id}"/>
	    <center>
		<input type="checkbox" class="set-period" {if $by_period==1}checked{/if}/>
		Отображать документы {html_select_date display_days=false prefix=docStart_} по {html_select_date display_days=false prefix=docEnd_}&nbsp;<input type="submit" value="&raquo;"/>
	    </center>
    </form>
</div>
